<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div>
        <span>手机号</span>
        <input/>
        <button>发送</button>
    </div>
</body>
<script>
    //1.给button按钮绑定一个点击事件
    //2.先把按钮禁用掉
    //3.按钮的内容显示剩余时间
    //4.剩余时间结束之后正常显示按钮
    var bn = document.querySelector('button');
    var i = 5;
    bn.addEventListener('click', function() {
        this.disabled = 'disabled';
        var a1 = setInterval(function() {
            if (i == 0) {
                clearInterval(a1);
                bn.disabled = '';
                bn.innerHTML = '发送';
                i = 5;
            } else {
                bn.innerHTML = '还有' + i + '秒才能发送';
                i--;
            }
        }, 1000);

    })
</script>

</html>